#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+5;
int n,num;
struct node{
    int u;
    bool v=true;
    bool la=true;
}du[MAX];
bool cmp(node a,node b){
    return a.u>b.u;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>du[i].u;
    num=n;
    sort(du+1,du+n+1,cmp);
    int i=2;
    while(true){
            int xtemp=3;
            while(!(du[i].u>du[xtemp].u && du[xtemp].la==true)){
                if(xtemp>n) break;
                xtemp++;
            }
            if(xtemp>n){
                i++;
                if(i>n){
                    break;
                }
                continue;
            }
            du[i].v=false;
            du[xtemp].la=false;
            num--;
            i++;
            while(du[i].la==false || du[i].v==false){
                if(i>n) break;
                i++;
            }
            if(i>n) break;
    }
    cout<<--num;
    fclose(stdin);
    fclose(stdout);
    return 0;
}
